import java.io.IOException;
import java.net.DatagramSocket;
import java.net.SocketException;
import java.util.HashMap;

public class TestDictServer extends TestUdpServer{
    private HashMap<String,String> hashMap = null;
    public TestDictServer(int port) throws SocketException {
        super(port);

        hashMap=new HashMap<>();
        hashMap.put("human","人");
        hashMap.put("impossible","不可能");
        hashMap.put("probable","大概");
        hashMap.put("scoundrel","恶棍");
        hashMap.put("trader","商人");
        hashMap.put("muppet","提线木偶");
    }
    @Override
    public String process(String request){
        return hashMap.getOrDefault(request,"没有找到词语!");
    }

    public static void main(String[] args) throws IOException {
        TestDictServer testDictServer = new TestDictServer(9090);
        testDictServer.start();
    }
}
